var now = getNowFormatDateTime(); 
var username = sessionStorage.getItem("name");
var userid = sessionStorage.getItem("userId");
var searchtype =1;
var flag;
var trStr;
$(document).ready(function(){
	$("#username").prepend(username);
	$('#searchButton').on('click',function(){
		if($('#shopcode').val()== "" || $('#shopcode').val()==undefined){
			alert("门店编码不能为空")
		}else{
			$("#data").text('');
			getData();
		}
	});
	getData();
});
function getData(){
	document.getElementById('data').innerHTML = "";
	$.ajax({
		url: '../../repair_info/weixiu_chaxvn'
		,type:'post'
		,dataType:'json'
		,contentType: "application/json; charset=utf-8"
		,data:JSON.stringify({"shopcode":$('#shopcode').val()})  
		,success: function(res){
			if(res.data.length>0){
				for (var i = 0; i < res.data.length; i++) {
						trStr += '<tr class="thin-border-bottom">'
							+'	<td class="orange" onclick="detail(\''+res.data[i].shopcode+'\',\''+res.data[i].deptname+'\')" >'+res.data[i].shopcode+'</span></td>'
							+'	<td>'+res.data[i].deptname+'</td>'
							+'	<td>正常</td>'
							+'</tr>'
					
				}
			}
			$('#data').append(trStr);
			trStr ="";
		}
	});
}
function detail(shopcode,shopname){
		var url= "../../mobile_page/weixiu/weixiu_chaxvn_search?shopcode="+shopcode+'&shopname='+encodeURI(encodeURI(shopname));//此处拼接内容
		window.location.href = url;
}